import request from '@/utils/request'
const API_PREFIX = '/service-auth/api/v1/auth'
import { Auth } from './types.ts'
/**
 *  登录
 * @param params
 * @returns
 */
export const doLogin = (params: Auth.Form) => {
    return request.post<Auth.Result>(`${API_PREFIX}/login`, params)
}

/**
 * 获取当前登录用户信息
 * @returns
 */
export const getUserAuthInfo = () => {
    return request.get<Auth.User>(`${API_PREFIX}/getInfo`)
}

/**
 * 退出登录
 * @returns
 */
export const doLogout = () => {
    return request.get(`${API_PREFIX}/logout`)
}

/**
 *  获取验证码
 * @returns
 */
export const getCaptcha = () => {
    return request.get<Auth.Captcha>(`${API_PREFIX}/captcha`)
}
